home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Amiga Format CD 38
/
Amiga Format CD38 (1999-03-15)(Future Publishing)(GB)(Track 1 of 3)[!][issue 1999-04].iso
/
-seriously_amiga-
/
programming
/
other
/
cyberxxxsrc
/
decoder
/
txt
/
fastc2p.asm
< prev
next >
Wrap
Assembly Source File
|
1999-02-08
|
7KB
|
343 lines
;prog:phxass/gigaphxass txt/FastC2P.asm to obj/FastC2P.o noexe
SECTION FastC2P,CODE
XDEF _FastC2P4
XDEF _FastC2P8
*-----------------------------------------------------------------------*
;
; Chunky2Planar Conversion Routine
bm_BytesPerRow equ 0
bm_Rows equ 2
bm_Flags equ 4
bm_Depth equ 5
bm_Pad equ 6
bm_Planes equ 8
_FastC2P4:
movem.l a2-a6/d2-d7,-(sp)
move.l #$00ff00ff,a3
move.l #$0f0f0f0f,a4
move.l #$33333333,a5
move.l #$55555555,a6
moveq #0,d0
move.w bm_BytesPerRow(a1),d0
moveq #1,d2
lsr.l d2,d1 ; Modulo halbieren, nötig für 4 Bit
sub.w d0,d1 ; Modulo berechnen
move.w d1,-(sp)
moveq #0,d1
move.b bm_Depth(a1),d1
add.w d1,d1
divu d1,d0
add.w d0,d0
move.w d0,a2
move.w bm_Rows(a1),d0
subq.w #1,d0
; add.w d1,d1
; jmp FastC2PTab-3*4(pc,d1.w)
FastC2P4:
move.l bm_Planes(a1),a1
.loop1
move.w a2,d1
lsr.w #1,d1
subq.w #1,d1
.loop2
movem.l (a0)+,d4-d7
move.l a3,d2
move.l a3,d3
and.l d4,d2
and.l d6,d3
eor.l d2,d4
eor.l d3,d6
lsl.l #8,d2
lsr.l #8,d6
or.l d3,d2
or.l d6,d4
move.l a3,d3
move.l a3,d6
and.l d5,d3
and.l d7,d6
eor.l d3,d5
eor.l d6,d7
lsl.l #8,d3
lsr.l #8,d7
or.l d6,d3
or.l d7,d5
move.l a4,d6
move.l a4,d7
and.l d4,d6
and.l d5,d7
eor.l d6,d4
eor.l d7,d5
lsl.l #4,d6
lsr.l #4,d5
or.l d7,d6
or.l d5,d4
move.l a4,d7
move.l a4,d5
and.l d2,d7
and.l d3,d5
eor.l d7,d2
eor.l d5,d3
lsl.l #4,d7
lsr.l #4,d3
or.l d5,d7
or.l d3,d2
swap d6
move.w d6,d3
move.w d4,d6
move.w d3,d4
swap d6
swap d7
move.w d7,d3
move.w d2,d7
move.w d3,d2
swap d7
move.l a5,d3
move.l a5,d5
and.l d4,d3
and.l d6,d5
eor.l d3,d4
eor.l d5,d6
lsl.l #2,d3
lsr.l #2,d6
or.l d5,d3
or.l d6,d4
move.l a5,d5
move.l a5,d6
and.l d2,d5
and.l d7,d6
eor.l d5,d2
eor.l d6,d7
lsl.l #2,d5
lsr.l #2,d7
or.l d6,d5
or.l d7,d2
move.l a6,d6
move.l a6,d7
and.l d4,d6
and.l d2,d7
eor.l d6,d4
eor.l d7,d2
lsr.l #1,d2
add.l d6,d6
or.l d2,d4
or.l d7,d6
move.l a6,d7
move.l a6,d2
and.l d3,d7
and.l d5,d2
eor.l d7,d3
eor.l d2,d5
lsr.l #1,d5
add.l d7,d7
or.l d5,d3
or.l d2,d7
move.w d7,(a1)+ ; bit 0
move.w a2,d2
move.w d3,-2(a1,d2.w) ; bit 1
add.w a2,d2
move.w d6,-2(a1,d2.w) ; bit 2
add.w a2,d2
move.w d4,-2(a1,d2.w) ; bit 3
dbra d1,.loop2
adda.w d2,a1
add.w (sp),a0 ; Modulo aufaddieren
dbra d0,.loop1
add.w #2,sp ; Modulo vom Stack nehmen
movem.l (sp)+,a2-a6/d2-d7
rts
_FastC2P8:
movem.l a2-a6/d2-d7,-(sp)
move.l #$00ff00ff,a3
move.l #$0f0f0f0f,a4
move.l #$33333333,a5
move.l #$55555555,a6
moveq #0,d0
move.w bm_BytesPerRow(a1),d0
sub.w d0,d1 ; Modulo berechnen
move.w d1,-(sp)
moveq #0,d1
move.b bm_Depth(a1),d1
add.w d1,d1
divu d1,d0
add.w d0,d0
move.w d0,a2
move.w bm_Rows(a1),d0
subq.w #1,d0
; add.w d1,d1
; jmp FastC2PTab-3*4(pc,d1.w)
FastC2P8:
move.l bm_Planes(a1),a1
.loop1
move.w a2,d1
moveq #1,d2
lsr.w d2,d1
sub.w d2,d1
.loop2
movem.l (a0)+,d4-d7
move.l a3,d2
move.l a3,d3
and.l d4,d2
and.l d6,d3
eor.l d2,d4
eor.l d3,d6
lsl.l #8,d2
lsr.l #8,d6
or.l d3,d2
or.l d6,d4
move.l a3,d3
move.l a3,d6
and.l d5,d3
and.l d7,d6
eor.l d3,d5
eor.l d6,d7
lsl.l #8,d3
lsr.l #8,d7
or.l d6,d3
or.l d7,d5
move.l a4,d6
move.l a4,d7
and.l d4,d6
and.l d5,d7
eor.l d6,d4
eor.l d7,d5
lsl.l #4,d6
lsr.l #4,d5
or.l d7,d6
or.l d5,d4
move.l a4,d7
move.l a4,d5
and.l d2,d7
and.l d3,d5
eor.l d7,d2
eor.l d5,d3
lsl.l #4,d7
lsr.l #4,d3
or.l d5,d7
or.l d3,d2
swap d6
move.w d6,d3
move.w d4,d6
move.w d3,d4
swap d6
swap d7
move.w d7,d3
move.w d2,d7
move.w d3,d2
swap d7
move.l a5,d3
move.l a5,d5
and.l d4,d3
and.l d6,d5
eor.l d3,d4
eor.l d5,d6
lsl.l #2,d3
lsr.l #2,d6
or.l d5,d3
or.l d6,d4
move.l a5,d5
move.l a5,d6
and.l d2,d5
and.l d7,d6
eor.l d5,d2
eor.l d6,d7
lsl.l #2,d5
lsr.l #2,d7
or.l d6,d5
or.l d7,d2
move.l a6,d6
move.l a6,d7
and.l d4,d6
and.l d2,d7
eor.l d6,d4
eor.l d7,d2
lsr.l #1,d2
add.l d6,d6
or.l d2,d4
or.l d7,d6
move.l a6,d7
move.l a6,d2
and.l d3,d7
and.l d5,d2
eor.l d7,d3
eor.l d2,d5
lsr.l #1,d5
add.l d7,d7
or.l d5,d3
or.l d2,d7
move.w d7,(a1)+ ; bit 0
move.w a2,d2
move.w d3,-2(a1,d2.w) ; bit 1
add.w a2,d2
move.w d6,-2(a1,d2.w) ; bit 2
add.w a2,d2
move.w d4,-2(a1,d2.w) ; bit 3
swap d7
add.w a2,d2
move.w d7,-2(a1,d2.w) ; bit 4
swap d3
add.w a2,d2
move.w d3,-2(a1,d2.w) ; bit 5
swap d6
add.w a2,d2
move.w d6,-2(a1,d2.w) ; bit 6
swap d4
add.w a2,d2
move.w d4,-2(a1,d2.w) ; bit 7
dbra d1,.loop2
adda.w d2,a1
add.w (sp),a0 ; Modulo aufaddieren
dbra d0,.loop1
add.w #2,sp ; Modulo vom Stack nehmen
movem.l (sp)+,a2-a6/d2-d7
rts
END